package io.renren.modules.haiyou.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


import io.renren.modules.haiyou.entity.SceneManagerApply;
import io.renren.modules.haiyou.service.SceneManagerApplyService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 景点管理员申请表
 *
 * @author Daniel Liu
 * @email llw599502537@gmail.com
 * @date 2021-01-22 19:03:06
 */
@RestController
@RequestMapping("/haiyou/scenemanagerapply")
public class SceneManagerApplyController {
    @Autowired
    private SceneManagerApplyService sceneManagerApplyService;

    /**
     * 列表
     */
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    @RequiresPermissions("haiyou:scenemanagerapply:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = sceneManagerApplyService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping(value = "/info/{id}", method = RequestMethod.GET)
    @RequiresPermissions("haiyou:scenemanagerapply:info")
    public R info(@PathVariable("id") String id){
		SceneManagerApply sceneManagerApply = sceneManagerApplyService.getById(id);

        return R.ok().put("sceneManagerApply", sceneManagerApply);
    }

    /**
     * 保存
     */
    @RequestMapping(value = "/save", method = RequestMethod.POST)
    @RequiresPermissions("haiyou:scenemanagerapply:save")
    public R save(@RequestBody SceneManagerApply sceneManagerApply){
		sceneManagerApplyService.save(sceneManagerApply);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping(value = "/update", method = RequestMethod.POST)
    @RequiresPermissions("haiyou:scenemanagerapply:update")
    public R update(@RequestBody SceneManagerApply sceneManagerApply){
		sceneManagerApplyService.updateById(sceneManagerApply);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping(value = "/delete", method = RequestMethod.POST)
    @RequiresPermissions("haiyou:scenemanagerapply:delete")
    public R delete(@RequestBody String[] ids){
		sceneManagerApplyService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
